home *** CD-ROM | disk | FTP | other *** search
- ;-------T-------T------------------------T----------------------------------;
- ;Scroll Memory
- ;-------------
- ;This demo shows you the power of the scrolling features by allowing you
- ;to scroll all over your chip ram :-). Usually you would set limits to stop
- ;you from going over the boundaries, but that's up to you.
- ;
- ;Use mouse to move around, LMB exits.
-
- INCDIR "INCLUDES:"
- INCLUDE "games/games_lib.i"
- INCLUDE "games/games.i"
-
- CALL MACRO
- jsr _LVO\1(a6)
- ENDM
-
- SECTION "ScrollMemory",CODE
-
- ;===========================================================================;
- ; INITIALISE DEMO
- ;===========================================================================;
-
- STARTGMS
-
- Start: MOVEM.L A0-A6/D1-D7,-(SP)
- move.l GMSBase(pc),a6
- lea ScreenTags(pc),a0
- CALL AddScreen
- tst.l d0
- beq.s .Error_Screen
-
- move.l Screen(pc),a0
- lea PictureTags(pc),a1
- move.l GS_MemPtr1(a0),PicData
- CALL LoadPic
- tst.l d0
- beq.s .Error_Picture
-
- CALL ShowScreen
- CALL InitJoyPorts
- bsr.s Main
-
- .ReturnToDOS
- move.l GMSBase(pc),a6
- move.l Picture(pc),a1
- CALL FreePic
- .Error_Picture
- move.l Screen(pc),a0
- CALL DeleteScreen
- .Error_Screen
- MOVEM.L (SP)+,A0-A6/D1-D7
- moveq #ERR_OK,d0
- rts
-
- ;===========================================================================;
- ; MAIN LOOP
- ;===========================================================================;
-
- Main: move.l Screen(pc),a0
- .loop moveq #JPORT1,d0
- moveq #JT_ZBXY,d1
- CALL ReadJoyPort
- btst #MB_RMB,d0
- bne.s .done
- move.w d0,d1
- asr.w #8,d0 ;d0 = X Change
- ext.w d1
-
- ;btst #MB_LMB,d0
- ;bne.s .MoveScreen
- .MovePicture
- add.w d0,GS_PicXOffset(a0)
- add.w d1,GS_PicYOffset(a0)
- CALL RemakeScreen
- CALL MovePicture
- CALL WaitVBL
- bra.s .loop
-
- .MoveScreen
- add.w d0,GS_ScrXOffset(a0)
- add.w d1,GS_ScrYOffset(a0)
- CALL RemakeScreen
- CALL MovePicture
- CALL WaitVBL
- bra.s .loop
- .done rts
-
- ;===========================================================================;
- ; DATA
- ;===========================================================================;
-
- ScreenTags:
- dc.l TAGS_GAMESCREEN
- Screen: dc.l 0
- dc.l GSA_Palette,Palette
- dc.l GSA_ScrWidth,320
- dc.l GSA_ScrHeight,256
- dc.l GSA_AmtColours,32
- dc.l GSA_Attrib,HSCROLL|VSCROLL|SBUFFER|CENTRE
- dc.l TAGEND
-
- Palette dc.l $000000,$103000,$F0C0B0,$F0A090,$D08080,$906050,$604040,$201010
- dc.l $400000,$404040,$F0F000,$403020,$C0C000,$105000,$500010,$808000
- dc.l $206010,$207010,$308020,$409020,$50A030,$50B040,$607070,$60C040
- dc.l $708080,$90A0A0,$B0C0C0,$800010,$900010,$A00020,$700010,$600010
-
- PictureTags:
- dc.l TAGS_PICTURE
- Picture dc.l 0
- dc.l PCA_Data
- PicData dc.l 0
- dc.l PCA_Width,320
- dc.l PCA_Height,256
- dc.l PCA_AmtColours,32
- dc.l PCA_Palette,Palette
- dc.l PCA_File,.File
- dc.l TAGEND
-
- .file dc.b "GMS:demos/data/PIC.Green",0
- even
-
-